describe('BreezeDateUtils', function(){
	
	it('get before 90 days date with current date', function(){
		var t_date = new Date();
		t_date.setFullYear(2011,9,1);
		expect(BreezeDateUtils.getDistanceDate(t_date , -90)).toEqual('2011-07-03');
	});
	
	it('get after 90 days date with current date', function(){
		var t_date = new Date();
		t_date.setFullYear(2011,9,1);
		expect(BreezeDateUtils.getDistanceDate(t_date , 90)).toEqual('2011-12-30');
	});
	
	it('get date without time with response date', function(){
		var t_rightDateValue = '2013-02-28T17:38:59',
				t_errorDateValue = '2013-02-28 17:38:59',
				t_jsDate = new Date();
		
		expect(BreezeDateUtils.getDateWithoutTime(t_errorDateValue)).toEqual(t_errorDateValue);
		
		expect(BreezeDateUtils.getDateWithoutTime(t_rightDateValue)).toEqual('2013-02-28');
		
		expect(BreezeDateUtils.getDateWithoutTime(t_jsDate)).toEqual(t_jsDate);
		
	});
	
	it('get utc date with date string', function(){
		var t_correctDateWithoutTime = new Date('2013', '1', '28'),
				t_correctDateHaveTime = new Date('2013', '1', '28', '17', '38', '59');
				
		var t_dateWithoutTime = BreezeDateUtils.requestDate2UTCDate('2013-02-28'),
				t_dateHaveTime = BreezeDateUtils.requestDate2UTCDate('2013-02-28T17:38:59');
				
		expect(t_dateWithoutTime.getYear()).toEqual(t_correctDateWithoutTime.getYear());
		expect(t_dateHaveTime.getTime()).toEqual(t_correctDateHaveTime.getTime());
	});

	it('leap years', function(){
		expect(BreezeDateUtils.isLeapYear(2000)).toBeTruthy();
		expect(BreezeDateUtils.isLeapYear(1999)).toBeFalsy();
		expect(BreezeDateUtils.isLeapYear(1900)).toBeFalsy();
	});
	
	it('convert date key string to Date object to adapt Phantomjs', function(){
		expect(BreezeDateUtils.dateForKey('2013-3-15')).toEqual(new Date(2013, 2, 15));
		expect(BreezeDateUtils.dateForKey('2013-03-15')).toEqual(new Date(2013, 2, 15));
	});
	
	it('get future date', function(){
		var t_futureLeapMonthDay = BreezeDateUtils.getFutureDates._FN.adjustFutureDay(2012, 2, 31);
		var t_future30th = BreezeDateUtils.getFutureDates._FN.adjustFutureDay(2012, 4, 31);
		expect(t_futureLeapMonthDay).toEqual(29);
		expect(t_future30th).toEqual(30);
		
		var t_currentYearRemainderContainer = BreezeDateUtils.getFutureDates._FN.populateCurrentYearRemainderDate(2013, 6, 25);
		expect(t_currentYearRemainderContainer.length).toEqual(6);
		expect(t_currentYearRemainderContainer[5].code).toEqual('2013-12-25T00:00:00');
		
		var t_populateDateContainer = BreezeDateUtils.getFutureDates._FN.populateWholeYearDates(2013, 31, 10);
		expect(t_populateDateContainer.length).toEqual(120);
		expect(t_populateDateContainer[25].code).toEqual('2016-02-29T00:00:00');
		expect(t_populateDateContainer[119].code).toEqual('2023-12-31T00:00:00');
		
		var t_buildLastYearDateContainer = BreezeDateUtils.getFutureDates._FN.populateLastYearDate(2014, 5, 15);
		expect(t_buildLastYearDateContainer.length).toEqual(4);
		expect(t_buildLastYearDateContainer[3].code).toEqual('2014-04-15T00:00:00');
		
		var t_futureDateContainer = BreezeDateUtils.getFutureDates('2013-03-15', 1);
		expect(t_futureDateContainer.length).toEqual(11);
		expect(t_futureDateContainer[9].code).toEqual('2014-01-15T00:00:00');
		
		var t_10YearsContainer = BreezeDateUtils.getFutureDates('2013-03-15', 10);
		expect(t_10YearsContainer.length).toEqual(107);
		expect(t_10YearsContainer[106].code).toEqual('2023-02-15T00:00:00');
	});

	it('get tomorrow', function (){
		var _tomorrow = BreezeDateUtils.getTomorrow('2013-04-11');
		expect(_tomorrow).toEqual('2013-04-12');
	});

});